using System.Xml.Linq;

namespace Savviety.ServiceManager.API.Criteria
{
    public class UnaryExpression : Expression
    {
        private readonly string _property;
        private readonly UnaryOperator _unaryOperator;
        private readonly ExpressionOperator _expressionOperator;

        public UnaryExpression(string property, UnaryOperator unaryOperator)
        {
            _property = property;
            _unaryOperator = unaryOperator;
        }
        public override XElement ToXElement()
        {
            Root = new XElement("UnaryExpression");
            var el = new XElement("ValueExpression");
            Root.Add(el);
            el.Add(GetLeftExpression(_property));
            Root.Add(GetUnaryOperatorXElement(_unaryOperator));
            
            return Root;
        }
    }
}